﻿



-- 查询考勤记录
CREATE procedure [dbo].[KqjlInfo_Get]
@sfzh varchar(18) = null,
@xm varchar(10) = null,
@kbs varchar(20) = null,
@kh varchar(10) = null,
@kqsjbegin datetime = null,
@kqsjend datetime = null,
@qybmm varchar(100) = null,
@fbm varchar(100) = null
as
select [kqlsh],[jsdm],[sfzh],[xm],[qybmm],[kh],[kbs],[kqsj],[jczt],
	   case [jczt] when 0 then '出' else '进' end [jczt_desc],[sfdj],[kqlx],[yyxp],[zpxp]
from Kqjl_Info
where 
(sfzh like @sfzh+'%' or @sfzh is null) 
and (xm like '%'+@xm+'%' or @xm is null) 
and (@kbs is null or kbs like @kbs+'%')
and (@kh is null or Kqjl_Info.kh=@kh)
and (@kqsjbegin is null or kqsj>=@kqsjbegin)
and (@kqsjend is null or kqsj<@kqsjend)
and (@qybmm is null or qybmm=@qybmm)
and (@fbm is null or fbm=@fbm or (@fbm='未知' and len(isnull(fbm,''))<1))
and jllx=0